/**
 LhapdfDistribution.h

 \file
 Declaration of class LhapdfDistribution.

 \author Thomas Burton 
 \date 3/9/12
 \copyright 2012 BNL. All rights reserved.
*/

//#ifdef USING_LHAPDF

#ifndef _LhapdfDistribution_H_
#define _LhapdfDistribution_H_

#include <Rtypes.h>

#include "tppmc/PartonContent.h"
#include "tppmc/PartonDistribution.h"

namespace tppmc {

   class Parton;

   /**
    kT-integrated PDF set using the LHAPDF C++ interface.
    
    TPPMC only uses the unpolarised distributions for
    computing the Sivers weight of each event.
    The actual generation of partons (including kT) is done by PYTHIA.
   */
   class LhapdfDistribution : public PartonDistribution {

   public:

      LhapdfDistribution();
      
      // Create a parton distribution using the LHAPDF interface.
      // Pass the set ID and member numbers.
      // See the table of IDs and members here:
      // http://projects.hepforge.org/lhapdf/manual#tth_sEcA
      // This is safe to use with multiple sets - the nset number used
      // by the LHAPDF interface is incremented each time this constructor
      // is called.
      LhapdfDistribution(unsigned setId, unsigned setMember);
      
      virtual ~LhapdfDistribution() { }
      
      virtual int Initialise();
      
      virtual void Evaluate(const Parton&, double scale, PartonContent&) const;

      virtual bool Supports(const Parton&) const;
      
      virtual double GetXMin() const;
      virtual double GetXMax() const;
      virtual double GetQ2Min() const;
      virtual double GetQ2Max() const;
      
      virtual unsigned getLhapdfSetNumber() const { return objectNumber_; }
      virtual unsigned getLhapdfSetId() const { return lhapdfSetId_; }
      virtual unsigned getLhapdfSetMember() const { return lhapdfSetMember_; }
      
      virtual std::string Name() const;

   protected:

      double evaluate(const Parton&, double Q2, LHAPDF::Flavour f) const;

      // Incremented each time the constructor is called
      static unsigned objectCount_;
      
      unsigned objectNumber_;
      unsigned lhapdfSetId_;
      unsigned lhapdfSetMember_;

      ClassDef(tppmc::LhapdfDistribution, 1)
   };   
}

#endif
